import * as constants from '../Constants'
import { get, GET_MANAGER_APPROVAL_LIST, GET_SECORD_SUBMIT_BY_ID } from '../../service/api'

export interface GetManagerApprovalList {
  type: constants.GetManagerApprovalList
  payload: Promise<any>
}
export interface GetManagerApprovalList_PENDING {
  type: constants.GetManagerApprovalList_PENDING
  payload: Promise<any>
}
export interface GetManagerApprovalList_FULFILLED {
  type: constants.GetManagerApprovalList_FULFILLED
  payload: any
}
export interface GetManagerApprovalList_Type {
  type: constants.GetManagerApprovalList_Type
  payload: number
}

export interface RECORD_ManagerApproval {
  type: constants.RECORD_ManagerApproval
  payload: Promise<any>
}

export interface RECORD_ManagerApproval_FULFILLED {
  type: constants.RECORD_ManagerApproval_FULFILLED
  payload: any
}

export type ManagerApprovalAction = GetManagerApprovalList | 
  GetManagerApprovalList_FULFILLED | 
  GetManagerApprovalList_PENDING |
  GetManagerApprovalList_Type |
  RECORD_ManagerApproval |
  RECORD_ManagerApproval_FULFILLED

export function recordType(param: number): GetManagerApprovalList_Type {
  return {
    type: constants.GetManagerApprovalList_Type,
    payload: param
  }
}

export function recoreMakes(params: any): RECORD_ManagerApproval {
  return {
    type: constants.RECORD_ManagerApproval,
    payload: get(GET_SECORD_SUBMIT_BY_ID, params)
  }
}

export function getManagerApprovalList(param: any): GetManagerApprovalList {
  return {
    type: constants.GetManagerApprovalList,
    payload: get(GET_MANAGER_APPROVAL_LIST, param)
  }
}